package com.me.study.ui.activity

import android.os.Bundle
import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.ToastUtils
import com.me.study.R
import com.me.study.app.base.BaseActivity
import com.me.study.databinding.ActivityHorizontalSlideBinding
import com.me.study.weight.HorizontalPicScrollerView.Companion.TYPE_DATA
import com.me.study.weight.HorizontalPicScrollerView.Companion.TYPE_LOAD_MORE
import com.me.study.weight.ItemPicInfo
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel

class HorizontalSlideActivity: BaseActivity<BaseViewModel, ActivityHorizontalSlideBinding>() {

    override fun layoutId() = R.layout.activity_horizontal_slide

    override fun initView(savedInstanceState: Bundle?) {
      mDatabind.apply {
          val list = mutableListOf<ItemPicInfo>()
          (0..7).forEach { _ ->
              list.add(
                  ItemPicInfo(
                      "https://img.china.alibaba.com/img/ibank/2013/101/139/834931101_1920026967.jpg",
                      TYPE_DATA
                  )
              )
          }
          list.add(ItemPicInfo(dataType = TYPE_LOAD_MORE))
          LogUtils.d("list数据:${list.size}，$list")
          hzSlidePicView.setData(list, { item ->
              //item Click
              ToastUtils.showLong("点击图片")
          }, {
              //查看更多
              ToastUtils.showLong("查看更多")
          })

          btnConfirm.setOnClickListener {
              hzSlidePicView.setData(list, { item ->
                  //item Click
                  ToastUtils.showLong("点击图片")
              }, {
                  //查看更多
                  ToastUtils.showLong("查看更多")
              })
          }
      }
    }

}